<template>
    <a-card :bordered="false">
        <div class="table-operator">
            <a-button shape="round" size="small" type="primary" icon="plus" @click="handleEdit({},'newUserActiveForm','新增')">添加</a-button>
        </div>

        <LTable
        ref="KhyCouponSchemeListTable"
        size="middle"
        rowKey="keyId"
        :formAttributes="formAttributes"
        :columns="columns"
        axiosUrl="/KhyCouponSchemeController/page"
        :showPagination="true"
        :showQueryForm="true"
        :initQuery="initQuery"
        :initOrder="initOrder"
      >
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'newUserActiveForm','详情')">详情</a>
        </span>
        
    </LTable>
    <newUserActiveForm ref="newUserActiveForm" @close="refresh('KhyCouponSchemeListTable')" @ok="refresh('KhyCouponSchemeListTable')"></newUserActiveForm> 
    </a-card>
</template>

<script>
import LTable from '@/components/lt/LTable'
import request from '@/utils/request'
import newUserActiveForm from './newUserActiveForm'
import {SysMixin} from '@/mixins/SysMixin'
import defaultSettings from '@/config/defaultSettings'
export default {
    name:'newUserActiveList',
    components:{
       LTable,newUserActiveForm
    },
    mixins:[SysMixin],
    data(){
        return{
            initQuery:[{field:'schemeType',val:'1'}],
            initOrder:[{field:'endDate',val:'desc'}],
            initDictCodes:defaultSettings.数据字典.优惠卷类型+','+defaultSettings.数据字典.是否,
            defaultSettings,
            formAttributes:[
                {field:'couponName',label:'优惠券名称',component:'input',condition:'like'},
                {field:'couponType',label:'优惠券类型',component:'select',condition:'eq',dictCode:defaultSettings.数据字典.优惠卷类型,},
            ],
         
            columns:[
                {
                    title: '序号',
                    dataIndex: '',
                    key:'rowIndex',
                    width:60,
                    align:"center",
                    customRender:function (t,r,index) {
                      return parseInt(index)+1;
                    }
                },
                 {
                    title: '优惠券名称',
                    dataIndex: 'couponName'
                },
                {
                    title: '截止日期',
                    dataIndex: 'endDate',
                },
                {
                    title: '优惠券类型',
                    dataIndex: 'couponType',
                    customRender:(text)=>{
                        if(!text){
                            return ''
                        }else{
                            return this.dictText(defaultSettings.数据字典.优惠卷类型,text)
                        }
                    }
                },
                {
                    title: '优惠金额',
                    dataIndex: 'couponValue'
                    
                },
                {
                    title: '单人发放数量',
                    dataIndex: 'perCount'
                    
                },
                
                {
                    title: '是否启用',
                    dataIndex: 'useSet',
                    customRender:(text)=>{
                        if(!text){
                            return ''
                        }else{
                            return this.dictText(defaultSettings.数据字典.是否,text)
                        }
                    }
                },
                
                {
                    title: '操作',
                    dataIndex: 'action',
                    width: '120px',
                    scopedSlots: { customRender: 'action' }
                }
            ],
            
        }
    },
    created(){
       
    },
    methods:{
       
    }
}
</script>